package com.warehouse.module.business.dal.mysql.company;

import java.util.*;

import com.warehouse.framework.common.pojo.PageResult;
import com.warehouse.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.warehouse.framework.mybatis.core.mapper.BaseMapperX;
import com.warehouse.module.business.dal.dataobject.company.CompanyDO;
import org.apache.ibatis.annotations.Mapper;
import com.warehouse.module.business.controller.admin.company.vo.*;

/**
 * 客户公司 Mapper
 *
 * @author admin
 */
@Mapper
public interface CompanyMapper extends BaseMapperX<CompanyDO> {

    default PageResult<CompanyDO> selectPage(CompanyPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CompanyDO>()
                .betweenIfPresent(CompanyDO::getCreateTime, reqVO.getCreateTime())
                .likeIfPresent(CompanyDO::getFullName, reqVO.getFullName())
                .likeIfPresent(CompanyDO::getCompanyName, reqVO.getCompanyName())
                .orderByDesc(CompanyDO::getCreateTime));
    }

    default List<CompanyDO> listCompanys(CompanyPageReqVO reqVO){
        return selectList(new LambdaQueryWrapperX<CompanyDO>()
                .betweenIfPresent(CompanyDO::getCreateTime, reqVO.getCreateTime())
                .likeIfPresent(CompanyDO::getFullName, reqVO.getFullName())
                .likeIfPresent(CompanyDO::getCompanyName, reqVO.getCompanyName())
                .orderByDesc(CompanyDO::getCreateTime));
    }

}